package com.leyou.sms.config;

import ch.qos.logback.classic.pattern.MessageConverter;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SmsConfig {


    @Bean
    public IAcsClient getIAcsClient(SmsProperties prop){
        DefaultProfile profile = DefaultProfile.getProfile(prop.getRegionID(), prop.getAccessKeyID(), prop.getAccessKeySecret());
        return   new DefaultAcsClient(profile);
    }
    //覆盖rabbitmq默认的jdk编码
    @Bean
    public Jackson2JsonMessageConverter getMessage(){
        return new Jackson2JsonMessageConverter();
    }
}
